home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d13 / pj9_3.arc / PANTEST.C < prev    next >
C/C++ Source or Header  |  1991-10-07  |  2KB  |  46 lines

  1. /* PAN-TEST.c --- Display Color Blocks and then pans the display              */
  2.  
  3. extern void Video_Mode (int Mode);        /* Set video mode using BIOS          */
  4. extern int SetLineLength (int Length);    /* Sets number of bytes per scan line */
  5. extern void SetViewPosition(int HPixel, int LineNum);    /* sets upper left pixel 
  6.                                                          to be seen on the display */
  7. extern void Set_Pixel(int x, int y, int Color);    /* Set a pixel at coordinate x,y 
  8.                                                    to a color */
  9. void main ()
  10. {
  11.     int i,j,k,l;            /* some loop variables */
  12.  
  13.     /* Step 1 */
  14.     Video_Mode ( 0x0d );    /* Set the video mode to 320x200x16  */
  15.  
  16.     /* Step 2 */
  17.     SetLineLength( 80 );    /* 80 Bytes wide virtual screen      */
  18.                             /* Sets up 2 wide by 4 high memory   */
  19.     /* Step 3 */
  20.     SetViewPosition( 0,0 ); /* Display upper left page initially */
  21.  
  22.     /* Step 4 */
  23.  /* Place graphics in video memory -- Make sure whatever routines you use 
  24.   * properly adjust for the new memory layout.                    */
  25.  
  26.     for (l=0; l<20; l++)            /* Draw a checkerboard of Colors             */
  27.         for (k=0; k<20; k++)        /* Not all of the board is initially visible */
  28.             for (j=0; j<18; j++)    /*  but will be revealed by panning          */
  29.                 for (i=0; i<32; i++)
  30.                     Set_Pixel( i+j*32, k + l*20, j + l);
  31.  
  32.     /* Step 5 -- now we pan a little */
  33.     for (i=0; i<320; i++)           /* 320 is first position page 2      */
  34.         SetViewPosition( i,0 );     /* Do a Horizontal Pan (Pixel)       */
  35.  
  36.     for (i=320; i>0; i--)           /* Diagonal Pan down and to the left */
  37.         SetViewPosition( i,320-i ); /*  to page 3/5 (120 lines down)     */
  38.  
  39.     for (i=0; i<320; i++)           /* Vertical Pan up to original pos.  */
  40.         SetViewPosition( 0,320-i ); /*  to page 1   (120 lines down)     */
  41.  
  42.     Video_Mode ( 3 );               /* Restore to text mode before exit  */
  43. };
  44.  
  45.  
  46.